package com.seamtop.cuber.common.base;

import com.seamtop.cuber.common.entriy.CuberCounter;
import com.seamtop.cuber.common.entriy.CuberReducer;
import com.seamtop.cuber.common.util.HttpUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import java.util.HashMap;

/**
 * Created by feng on 2015/10/17.
 */
public class CuberRemoteInit implements ICuberInit {

    public Document loadCuberCounter(String filePath) throws Exception{
        HashMap<String,CuberCounter> cuberCounterMap = new HashMap<String, CuberCounter>();
        String surl = filePath + "/conf/tableCounter.shtml";
        String content = HttpUtil.httpGet(surl);
        Document document = DocumentHelper.parseText(content);
        return document;
    }

    public Document loadTruthMData(String filePath) throws Exception {
        String surl = filePath + "/conf/tableSchema.shtml";
        String content = HttpUtil.httpGet(surl);
        Document document = DocumentHelper.parseText(content);
        return document;
    }

    public Document loadVirtualMData(String filePath) throws Exception {
        String surl = filePath + "/conf/tableVirtuals.shtml";
        String content = HttpUtil.httpGet(surl);
        Document document = DocumentHelper.parseText(content);
        return document;
    }

    public Document loadCuberReducer(String filePath) throws Exception {
        String surl = filePath + "/conf/tableReducer.shtml";
        String content = HttpUtil.httpGet(surl);
        Document document = DocumentHelper.parseText(content);
        return document;
    }
}
